const Promise = require('bluebird');
async function main(a, b, callback) {
  const arr = a + b;
  console.log('a=' + a);
  console.log('b=' + b);
  return callback(null, arr);
}
async function foo(c, d, callback) {
  console.log('c=' + c);
  console.log('d=' + d);
  return callback(error);
}

async function fu(a,b) {
  const function2 = Promise.promisify(foo)  
  const function1 = Promise.promisify(main)
  
  const data1 = await function1(a,b);
  for (let i = 0; i < data1.length; i++) {
    const data = data1[i];
    try {
      await function2(data.a, b);
    } catch (error) {
      console.log(error);
    }
  } 
}
fu(2,5);